package br.com.future.domain;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

public class User {

	private long id;
	private String name;
	private String email;
	private String login;
	private String passwd;

	public User(long id, String name, String email) {
		this.id = id;
		this.name = name;
		this.email = email;
	}

	public User(String name, String email, String login, String passwd) {
		this.name = name;
		this.email = email;
		this.login = login;
		this.passwd = passwd;
	}

	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public String getPasswd() {
		return passwd;
	}

	public void setPasswd(String passwd) {
		this.passwd = passwd;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public long getId() {
		return id;
	}

	@Override
    public String toString() {
        return new ToStringBuilder(this)
            .append(id)
            .append(name)
            .append(email)
            .append(login)
            .append(passwd)
            .toString();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder()
            .append(id)
            .append(name)
            .append(email)
            .append(login)
            .append(passwd)
            .toHashCode();
    }

    @Override
    public boolean equals(Object other) {
        if (!(other instanceof User)) {
            return false;
        }
        User castOther = (User) other;
        return new EqualsBuilder()
            .append(id, castOther.id)
            .append(name, castOther.name)
            .append(email, castOther.email)
            .append(login, castOther.login)
            .append(passwd, castOther.passwd)
            .isEquals();
    }
}
